﻿@model CreateTaskVM

@{
    ViewBag.Title = "สร้างคำขออนุมัติ"; 
}

<!--# Include title and reason textbox -->
@using (Html.BeginForm("SendAskApproval", "AskForApproval", FormMethod.Post, new { @class = "form-horizontal" }))
{
     @Html.AntiForgeryToken()
    
    <div class="block-button-menu-above">
        <button class="btn button-standard-width btn-small btn-info"
             type="button" onclick="javascript:history.back();">
            <i class="icon-ok bigger-120"></i>&nbsp;&nbsp;ย้อนกลับ
        </button> 
        <button class="btn button-standard-width btn-small btn-yellow" type="submit">
            <i class="icon-ok bigger-120"></i>&nbsp;&nbsp;ยืนยันการส่งขออนุมัติ
        </button>
    </div> 
    
    @Html.Partial("_EditorFormAskApproval")
    @Html.ValidationSummary(true, ValidateText.RequiredField, new { @class = "alert alert-error" })
}
 
@Html.Partial("~/Views/Task/_RelatedPageFrame.cshtml", new Dictionary<string, int> { { "AppPrcId", Model.AppPrcId }, { "RefId", Model.RefId }, { "Related", 1 } })

@section scripts
{
    <script>
        $(function() {
            var lastHeight1 = 0, curHeight1 = 0, $frame1 = $('#iframe1');
            setInterval(function() {
                curHeight1 = $frame1.contents().find('body').height() + 40;
                if (curHeight1 != lastHeight1) {
                    $frame1.css('height', (lastHeight1 = curHeight1) + 'px');
                }
            }, 500);
        });

        $("form").not("#formsearch").submit(function (e) {
            e.preventDefault();
            var currentForm = this;
            bootbox.confirm("ท่านต้องการยืนยัน ใช่หรือไม่", function (result) {
                if (result) {
                    currentForm.submit();
                }
            });
        });
    </script>
}